package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.UserMoney;
import cn.liyicun.cp.cpweb.entity.UserMoneyExample;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface UserMoneyMapper extends Serializable {
    @SelectProvider(type=UserMoneySqlProvider.class, method="countByExample")
    long countByExample(UserMoneyExample example);

    @DeleteProvider(type=UserMoneySqlProvider.class, method="deleteByExample")
    int deleteByExample(UserMoneyExample example);

    @Delete({
        "delete from user_money",
        "where uid = #{uid,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long uid);

    @Insert({
        "insert into user_money (uid, money, ",
        "locking)",
        "values (#{uid,jdbcType=BIGINT}, #{money,jdbcType=DECIMAL}, ",
        "#{locking,jdbcType=VARCHAR})"
    })
    int insert(UserMoney record);

    @InsertProvider(type=UserMoneySqlProvider.class, method="insertSelective")
    int insertSelective(UserMoney record);

    @SelectProvider(type=UserMoneySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="money", property="money", jdbcType=JdbcType.DECIMAL),
        @Result(column="locking", property="locking", jdbcType=JdbcType.VARCHAR)
    })
    List<UserMoney> selectByExampleWithRowbounds(UserMoneyExample example, RowBounds rowBounds);

    @SelectProvider(type=UserMoneySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="money", property="money", jdbcType=JdbcType.DECIMAL),
        @Result(column="locking", property="locking", jdbcType=JdbcType.VARCHAR)
    })
    List<UserMoney> selectByExample(UserMoneyExample example);

    @Select({
        "select",
        "uid, money, locking",
        "from user_money",
        "where uid = #{uid,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="money", property="money", jdbcType=JdbcType.DECIMAL),
        @Result(column="locking", property="locking", jdbcType=JdbcType.VARCHAR)
    })
    UserMoney selectByPrimaryKey(Long uid);

    @UpdateProvider(type=UserMoneySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserMoney record, @Param("example") UserMoneyExample example);

    @UpdateProvider(type=UserMoneySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserMoney record, @Param("example") UserMoneyExample example);

    @UpdateProvider(type=UserMoneySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UserMoney record);

    @Update({
        "update user_money",
        "set money = #{money,jdbcType=DECIMAL},",
          "locking = #{locking,jdbcType=VARCHAR}",
        "where uid = #{uid,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(UserMoney record);
}